#ifndef		_MUSHROOM_H
#define		_MUSHROOM_H

#include <Ogre.h>
#include <OIS/OIS.h>
class TerrainEx;

using namespace Ogre;

#define MUSHROOMFRAMESCALE	0.5
#define JUMPHEIGHT	6.0F
class Mushroom
{
private:
	TerrainEx*					m_pterrain;
	SceneManager*				m_pSceneMgr;
	SceneNode*					m_pJumpNode;
	Entity*						m_pJumpEntity;
	SceneNode*					m_pMushroomNode;
	Entity*						m_pMushroomEntity;
	SceneNode*					m_pMushroomTraceNode;
	Entity*						m_pMushroomTraceEntity;
	SceneNode*					m_pMushroomRangeNode;
	Entity*						m_pMushroomRangeEntity;
	SceneNode*					m_pMushroomCollisionNode;
	Entity*						m_pMushroomCollisionEntity;

	AnimationState*				mp_animState; 
	bool						m_bWalking;
	float						m_fWalkingSpeed;
	float						m_fWalkingScale;
	
	float						m_fjumpVelocity;
	float						m_fjumpScale;
	size_t						m_tjumping;

	static int					m_nCount;
public:
	Mushroom(SceneManager* mscenemgr, TerrainEx* mterrain =0);
	~Mushroom();
	void createMushroom(Vector3&	fromPos, SceneNode* MushroomTraceNode =0);
	void updateMushroom(const Ogre::FrameEvent &evt);


protected:
	void traceObject(const Ogre::FrameEvent &evt);
	void jumpObject(const Ogre::FrameEvent &evt);
	void updateAnimations(const Ogre::FrameEvent &evt);
	void fadeAnimations(const Ogre::FrameEvent &evt);
	Vector3 checkGround();

public:
	SceneNode*	getCollisionObject()
	{
		return m_pMushroomCollisionNode;
	}

};

#endif
